﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Tetris
{
    class GameEngine
    {
        private GameField mainField { get; set; }
        private Renderer render { get; set; }
        private Blocks block { get; set; }
        private TickGenerator tickGenerator = new TickGenerator();
        public SquareBlock squareBlock = new SquareBlock();
        public ChangePosition change = new ChangePosition();
        
        public void Start(GameField gameField, Renderer render1, Blocks block1)
        


        {
            this.mainField = gameField;
            this.render = render1;
            this.block = block1;


            tickGenerator.Tick += tickGenerator_Tick;
            tickGenerator.Start();


           
        }

        private void tickGenerator_Tick(object sender, EventArgs e)
        {
            //SquareBlock squqreBlock = new SquareBlock();
            render.RenderField(mainField);
            change.Change();
          //  render.RenderBlock(squqreBlock.Position1(mainField.centreX, mainField.centreY));
           // render.RenderBlock(squareBlock.Position1(mainField.centreX, mainField.centreY));
            
            
            //List<PieceOfBlocks> square = block.SquareBlock(mainField, 5, 1);
          //  render.RenderBlock(square);
           
            //render.RenderBlock(block.PyramidBlock());
           // render.RenderBlock(block.LineBlock());
            //render.RenderBlock(block.Z_Block());
          //render.RenderBlock(block.StrangeBlock());
            Console.Beep();
        }
        public void Pause()
        {

        }
        public void Stop()
        {

        }
    
    }
}
